<!DOCTYPE html>
<html lang="en">

<head>
    <!-- META DATA -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->

    <!-- TITLE OF SITE -->
    <title>伯俊微后台</title>
    <!--linear icon css-->
    <link rel="stylesheet" href="assets/css/icon-font.min.css">
    <!--bootstrap.min.css-->
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/search_box.css">
    <!--style.css-->
    <link rel="stylesheet" href="assets/css/style.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css">

    <!--<script src="assets/js/bootstrap.min.js"></script>-->


    <style>

        #shht {
            /*-webkit-box-shadow:3px 3px 3px #c8c8c8 ;
            -moz-box-shadow:3px 3px 3px #c8c8c8 ;*/
            box-shadow: 0 0 7px #c8c8c8;
            display: none;
        }


    </style>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        a {
            text-decoration: none;
        }

        a:hover {
            text-decoration: none;
        }

        .tcdPageCode {
            padding: 15px 20px;
            /*text-align: left;*/
            color: #ccc;
            text-align: center;
        }

        .tcdPageCode a {
            display: inline-block;
            color: #428bca;
            height: 25px;
            line-height: 25px;
            padding: 0 10px;
            border: 1px solid #ddd;
            margin: 0 2px;
            border-radius: 4px;
            vertical-align: middle;
        }

        .tcdPageCode a:hover {
            text-decoration: none;
            border: 1px solid #428bca;
        }

        .tcdPageCode span.current {
            display: inline-block;
            height: 25px;
            line-height: 25px;
            padding: 0 10px;
            margin: 0 2px;
            color: #fff;
            background-color: #428bca;
            border: 1px solid #428bca;
            border-radius: 4px;
            vertical-align: middle;
        }

        .tcdPageCode span.disabled {
            display: inline-block;
            height: 25px;
            line-height: 25px;
            padding: 0 10px;
            margin: 0 2px;
            color: #bfbfbf;
            background: #f2f2f2;
            border: 1px solid #bfbfbf;
            border-radius: 4px;
            vertical-align: middle;
        }

        #on_lable {
            border: 0;
            text-decoration: none;
            background: #2196f3;
            color: #f2f2f2;
            font-size: 16px;
            font-family: 微软雅黑, 宋体, Arial, Helvetica, Verdana, sans-serif;
            font-weight: bold;
            border-radius: 3px;
            -webkit-transition: all linear 0.30s;
            -moz-transition: all linear 0.30s;
            transition: all linear 0.30s;
            position: absolute;
            height: 33px;
            width: 80px;
            text-align: center;
            line-height: 33px;
            top: 15px;
            left: 15%;
        }

        .bt-bj {
            border: 0;
            color: #0ebeff;
            background-color: rgba(255, 254, 254, 0);
        }
    </style>
</head>

<body style="font-family: Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft">

<!-- wrapper -->
<div id="wrapper">

    <!-- navbar -->
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="brand" style="overflow: hidden;width: 12.6%;">
            <a href="vip-pos.html">
                <!--<img src="assets/images/logo1.png" style="display: block;width: 100%;margin: 0 auto;">-->
                <h2 style="color: #fcfdfd">控制台</h2>
            </a>
        </div><!--/.brand -->
        <div class="container-fluid">
            <div class="navbar-btn">
                <button type="button" class="btn-toggle-fullwidth">
                    <i class="lnr lnr-arrow-left-circle"></i>
                </button>
            </div><!--/.navbar-btn -->
            <form class="navbar-form navbar-left" style="margin-bottom: 0;">
                <div style="line-height: 50px;font-weight: bold;">
                    <a href="index.html"
                       style="display: block;float: left;padding: 0 15px;margin: 0 10px;cursor: pointer;padding-bottom: 10px;;">总览</a>
                    <a href="javascript:void(0);" id="shht-sj"
                       style="display: block;float: left;padding: 0 15px;margin: 0 10px;cursor: pointer;padding-bottom: 10px;">
                        商户后台
                        <span class="fa fa-angle-down"
                              style="font-size:25px;position: absolute;margin: 12px 0 0 2px;">  </span>
                    </a>
                    <a href="bos-config.html"
                       style="display: block;float: left;padding: 0 15px;margin: 0 10px;cursor: pointer;padding-bottom: 10px;">系统设置</a>
                    <a href="wechat-index.html"
                       style="display: block;float: left;padding: 0 15px;margin: 0 10px;cursor: pointer;padding-bottom: 10px;">微生活</a>
                </div>
            </form><!--/form -->
            <div id="shht"
                 style="width: 500px;height: 300px;position: absolute;top: 67px;left: 100px;background-color: #fcfdfd">

                <div style="margin-left: 180px;">
                    <h4 style=" margin: 40px 0 22px 35px; color: black; font-size: 15px;">
                        <b>会员管理</b></h4>
                    <ul style="list-style:none;font-size: 12px;margin: 20px 0 30px 35px;">
                        <li style="margin: 15px 0 0 0;"><a href="vip-wx.html">会员列表</a></li>
                        <li style="margin: 15px 0 0 0;"><a href="vip-label.html">会员标签</a></li>
                        <!-- <li style="margin: 15px 0 0 0;"><a href="#">会员列表</a></li>-->
                    </ul>
                </div>

                <div style="margin-left: 70px;margin-top: -148px;">
                    <h4 style=" margin: 62px 0 22px 35px; color: black; font-size: 15px;">
                        <b>门店管理</b></h4>
                    <ul style="list-style:none;font-size: 12px;margin: 20px 0 30px 35px;">
                        <li style="margin: 15px 0 0 0;"><a href="store.html">门店列表</a></li>
                        <!-- <li style="margin: 15px 0 0 0;"><a href="#">门店体系</a></li>
<li style="margin: 15px 0 0 0;"><a href="#">门店状态</a></li>-->
                    </ul>
                </div>
                <div style="margin-left: 70px;">
                    <h4 style=" margin: 62px 0 22px 35px; color: black; font-size: 15px;">
                        <b>营销活动</b></h4>
                    <ul style="list-style:none;font-size: 12px;margin: 20px 0 30px 35px;">
                        <li style="margin: 15px 0 0 0;"><a href="coupon-y.html">优惠券</a></li>
                        <li style="margin: 15px 0 0 0;"><a href="activity.html">活动管理</a></li>
                    </ul>
                </div>

            </div>
            <div class="navbar-menu">
                <ul class="nav navbar-nav navbar-right">

                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <!--<img src="assets/images/parson.png" class="img-circle" alt="parson-img">-->
                            <span style="font-size: 15px;color: #000;">账户信息</span>
                            <i class="icon-submenu fa fa-angle-down"></i>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="#"><i class="lnr lnr-user"></i> <span>账户信息</span></a></li>
                            <li><a href="change-password.html"><i class="lnr lnr-cog"></i> <span>修改密码</span></a></li>
                            <li id="e-exit"><a href="#"><i class="lnr lnr-envelope"></i> <span>退出登录</span></a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div><!--/.container-fluid -->

    </nav>
    <!-- END NAVBAR -->

    <!-- LEFT SIDEBAR -->
    <div id="sidebar-nav" class="sidebar">
        <div class="sidebar-scroll">
            <h3 style="color: #ffffff;padding: 0 0 0 8%">门店管理</h3>
            <nav>
                <ul class="nav">

                    <li class="active">
                        <a href="#">
                            <!--<i data-feather="home"></i>--> <span>门店列表</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>

    </div>
    <!-- END LEFT SIDEBAR -->

    <!-- MAIN -->
    <div class="main">

        <div class="row">
            <script type="text/javascript" src="js/angular.min.js"></script>
            <script type="text/javascript" src="js/ui-bootstrap-tpls.min.js"></script>

            <div class="col-md-6 col-sm-6" style="width: 100%;margin: 0 auto;background-color: #fff;">
                <div id="on_lable">同步门店</div>
                <div>
                    <p id="count" style="margin: 14px 0 14px 23px">共0店</p>

                    <!--搜索框-->
                    <div class="container" style="position: absolute;top: -20px;left: 660px;">
                        <div id="search">
                            <input id="find" type="text"><!--placeholder="输入卡号/VIP等级/开卡店仓/开卡时间,支持条件符号"-->
                            <input id="find-button" class="button" type="button" value="搜索">
                        </div>
                    </div>

                    <div class="panel">

                        <table class="table">
                            <colgroup>
                                <col width="80">
                                <col width="60">
                                <!--<col width="60">-->
                                <!--<col width="60">-->
                                <col width="60">
                                <col width="80">
                                <col width="120">
                                <col width="70">
                            </colgroup>
                            <thead>
                            <tr>
                                <td>名称</td>
                                <td>经销商</td>
                                <!--<td>店仓性质</td>-->
                                <!-- <td>销售区域</td>-->
                                <td>联系人</td>
                                <td>电话</td>
                                <td>地址</td>
                                <td>操作</td>
                            </tr>
                            </thead>
                            <tbody id="data">
                            <tr class="sb-tr" style="background-color: rgb(255, 255, 255);">
                                <td>廊坊新华路店</td>
                                <td>MGG总部</td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td>
                                    <div>
                                        <input type="button" value="编辑" class="bt-bj">
                                    </div>
                                </td>
                            </tr>
                            <tr class="sb-tr" style="background-color: rgb(255, 255, 255);">
                                <td>廊坊新华路店</td>
                                <td>MGG总部</td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td>
                                    <input type="button" value="编辑" class="bt-bj" onclick="toConfig()">
                                </td>
                            </tr>
                            <tr class="sb-tr" style="background-color: rgb(255, 255, 255);">
                                <td>廊坊新华路店</td>
                                <td>MGG总部</td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td>
                                    <div>
                                        <input type="button" value="编辑" class="bt-bj">
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <!--分页栏-->
                    <div class="tcdPageCode" style="height: 100px;"></div>
                </div>
            </div>
        </div>
    </div>
</div>

</div>
<!-- END MAIN -->

<div class="clearfix"></div>


</div>
<!-- END WRAPPER -->


<script src="js/jquery.min.js"></script>

<script src="assets/js/fontawesome-all.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>

</body>
<script src="assets/js/jq.page.js"></script>


<script>
    $("#shht-sj,#shht").hover(function () {
        // 鼠标移入时添加hover类

        $("#shht").css('display', 'inline')
    }, function () {
        // 鼠标移出时移出hover类

        $("#shht").css('display', 'none')
    });

    $(".bt-bj").hover(function () {
        // 鼠标移入时添加hover类

        $(this).css('color', '#00e0ff')
    }, function () {
        // 鼠标移出时移出hover类

        $(this).css('color', '#0ebeff')
    });


</script>
<script>
    var y;

    //获取键盘搜索按钮事件
    $("#find").on('keypress', function (e) {
        var keycode = e.keyCode;
        //获取搜索框的值
        var searchContent = $(this).val();
        if (keycode == '13') {
            e.preventDefault();
            //请求搜索接口
            if (searchContent == '') {
                alert('请输入搜索内容！');
            } else {
                FindStoreData(0, searchContent)
            }
        }
    });
    $(document).ready(
        getData(0)
    );

    $("#find-button").click(function () {
            var row = $("#find").val();
            FindStoreData(0, row)
        }
    );
    $("#on_lable").click(function () {
        $.ajax({
            "url": "/store/sync/",
            "dataType": "json",
            "success": function (json) {
                if (json.state == 200) {
                    alert("同步成功")
                } else {
                    alert(json.message)
                }
            }
        })
    });

    function toConfig(id, name) {
        location.href = "store-config.html?id=" + id + "&store=" + name;
    }

    function getData(start) {
        $.ajax({
            "url": "/store/data/",
            "data": "start=" + start,
            "type": "POST",
            "dataType": "json",
            "success": function (json) {
                var map = json;
                y = map.data.count;
                $("#count").text("共" + map.data.count + "店");
                $("#data").empty();

                for (var i = 0; i < map.data.data.length; i++) {
                    var data = map.data.data[i];
                    var html = '<tr class="sb-tr">' +
                        '<td>#{name}</td>' +
                        '<td>#{customerup}</td>' +
                        /*'<td>#{storekind}</td>' +*/
                        /* '<td>#{area}</td>' +*/
                        '<td>#{contactor}</td>' +
                        '<td>#{phone}</td>' +
                        '<td>#{address}</td>' +
                        '<td><input type="button" value="编辑" class="bt-bj" onclick="toConfig(#{id},\'#{name}\')"></td></tr>';
                    html = html.replace("#{name}", data.name);
                    html = html.replace("#{id}", data.id);
                    html = html.replace("#{name}", data.name.replace("null", ""));
                    html = html.replace("#{customerup}", data.customerup.replace("null", ""));
                    html = html.replace("#{storekind}", data.storekind.replace("null", ""));

                    html = html.replace("#{contactor}", data.contactor.replace("null", ""));
                    html = html.replace("#{phone}", data.phone.replace("null", ""));
                    html = html.replace("#{address}", data.address.replace("null", ""));
                    html = html.replace("#{creationdate}", data.creationdate.replace("null", ""));

                    $("#data").append(html);
                }
                var num = Math.floor(y / 50);
                if (num < 1) {
                    num = 1
                }
                $(".tcdPageCode").createPage({
                    pageCount: num,//总页面
                    current: start + 1,//起始页
                    backFn: function (p) {
                        console.log(p);
                        //单击回调方法，p是当前页码
                        Data(p - 1)
                    }
                });
                $(".sb-tr").hover(function () {
                    // 鼠标移入时添加hover类

                    $(this).css('background-color', 'rgba(226,238,252,0.88)')
                }, function () {
                    // 鼠标移出时移出hover类

                    $(this).css('background-color', '#ffffff')
                });
            }
        })

    }

    function Data(start) {
        $.ajax({
            "url": "/store/data/",
            "data": "start=" + start,
            "type": "POST",
            "dataType": "json",
            "success": function (json) {
                var map = json;
                y = map.data.count;
                $("#count").text("共" + map.data.count + "店");
                $("#data").empty();
                for (var i = 0; i < map.data.data.length; i++) {
                    var data = map.data.data[i];
                    var html = '<tr class="sb-tr">' +
                        '<td>#{name}</td>' +
                        '<td>#{customerup}</td>' +
                        /* '<td>#{storekind}</td>' +*/
                        /*   '<td>#{area}</td>' +*/
                        '<td>#{contactor}</td>' +
                        '<td>#{phone}</td>' +
                        '<td>#{address}</td>' +
                        '<td><input type="button" value="编辑" class="bt-bj" onclick="toConfig(#{id},\'#{name}\')"></td></tr>';
                    html = html.replace("#{name}", data.name);
                    html = html.replace("#{id}", data.id);
                    html = html.replace("#{name}", data.name.replace("null", ""));
                    html = html.replace("#{customerup}", data.customerup.replace("null", ""));
                    html = html.replace("#{storekind}", data.storekind.replace("null", ""));

                    html = html.replace("#{contactor}", data.contactor.replace("null", ""));
                    html = html.replace("#{phone}", data.phone.replace("null", ""));
                    html = html.replace("#{address}", data.address.replace("null", ""));
                    html = html.replace("#{creationdate}", data.creationdate.replace("null", ""));

                    $("#data").append(html);
                }
                $(".sb-tr").hover(function () {
                    // 鼠标移入时添加hover类

                    $(this).css('background-color', 'rgba(226,238,252,0.88)')
                }, function () {
                    // 鼠标移出时移出hover类

                    $(this).css('background-color', '#ffffff')
                });
            }
        })
    }

    function FindStoreData(start, message) {
        $.ajax({
            "url": "/store/find/",
            "data": "start=" + start + "&message=" + message,
            "type": "POST",
            "dataType": "json",
            "success": function (json) {
                var map = json;
                y = map.data.count;
                $("#count").text("共" + map.data.count + "店");
                $("#data").empty();
                for (var i = 0; i < map.data.data.length; i++) {
                    var data = map.data.data[i];
                    var html = '<tr class="sb-tr">' +
                        '<td>#{name}</td>' +
                        '<td>#{customerup}</td>' +
                        /* '<td>#{storekind}</td>' +*/
                        /* '<td>#{area}</td>' +*/
                        '<td>#{contactor}</td>' +
                        '<td>#{phone}</td>' +
                        '<td>#{address}</td>' +
                        '<td><input type="button" value="编辑" class="bt-bj" onclick="toConfig(#{id},\'#{name}\')"></td></tr>';
                    html = html.replace("#{name}", data.name);
                    html = html.replace("#{id}", data.id);

                    html = html.replace("#{name}", map.data.data[i].name.replace("null", ""));
                    html = html.replace("#{customerup}", map.data.data[i].customerup.replace("null", ""));
                    html = html.replace("#{storekind}", map.data.data[i].storekind.replace("null", ""));

                    html = html.replace("#{contactor}", map.data.data[i].contactor.replace("null", ""));
                    html = html.replace("#{phone}", map.data.data[i].phone.replace("null", ""));
                    html = html.replace("#{address}", map.data.data[i].address.replace("null", ""));
                    html = html.replace("#{creationdate}", map.data.data[i].creationdate.replace("null", ""));

                    $("#data").append(html);
                }

                var num = Math.floor(y / 50);
                if (num < 1) {
                    num = 1
                }
                $(".tcdPageCode").createPage({

                    pageCount: num,//总页面
                    current: start + 1,//起始页
                    backFn: function (p) {
                        console.log(p);
                        //单击回调方法，p是当前页码
                        FindData(p - 1, message)
                    }
                });
                $(".sb-tr").hover(function () {
                    // 鼠标移入时添加hover类

                    $(this).css('background-color', 'rgba(226,238,252,0.88)')
                }, function () {
                    // 鼠标移出时移出hover类

                    $(this).css('background-color', '#ffffff')
                });
                $(".sb-tr").hover(function () {
                    // 鼠标移入时添加hover类

                    $(this).css('background-color', 'rgba(226,238,252,0.88)')
                }, function () {
                    // 鼠标移出时移出hover类

                    $(this).css('background-color', '#ffffff')
                });
            }
        })
    }

    function FindData(start, message) {
        $.ajax({
            "url": "/vip/posfind/",
            "data": "start=" + start + "&message=" + message,
            "type": "POST",
            "dataType": "json",
            "success": function (json) {
                var map = json;
                y = map.data.count;
                $("#count").text("共" + map.data.count + "店");
                $("#data").empty();
                for (var i = 0; i < map.data.data.length; i++) {
                    var data = map.data.data[i];
                    var html = '<tr class="sb-tr">' +
                        '<td>#{name}</td>' +
                        '<td>#{customerup}</td>' +
                        /*  '<td>#{storekind}</td>' +*/
                        /* '<td>#{area}</td>' +*/
                        '<td>#{contactor}</td>' +
                        '<td>#{phone}</td>' +
                        '<td>#{address}</td>' +
                        '<td><input type="button" value="编辑" class="bt-bj" onclick="toConfig(#{id},\'#{name}\')"></td></tr>';
                    html = html.replace("#{name}", data.name);
                    html = html.replace("#{id}", data.id);

                    html = html.replace("#{name}", map.data.data[i].name.replace("null", ""));
                    html = html.replace("#{customerup}", map.data.data[i].customerup.replace("null", ""));
                    html = html.replace("#{storekind}", map.data.data[i].storekind.replace("null", ""));

                    html = html.replace("#{contactor}", map.data.data[i].contactor.replace("null", ""));
                    html = html.replace("#{phone}", map.data.data[i].phone.replace("null", ""));
                    html = html.replace("#{address}", map.data.data[i].address.replace("null", ""));
                    html = html.replace("#{creationdate}", map.data.data[i].creationdate.replace("null", ""));

                    $("#data").append(html);
                }
                $(".sb-tr").hover(function () {
                    // 鼠标移入时添加hover类

                    $(this).css('background-color', 'rgba(226,238,252,0.88)')
                }, function () {
                    // 鼠标移出时移出hover类

                    $(this).css('background-color', '#ffffff')
                });
            }
        })
    }

</script>
<script>
    $("#e-exit").click(function () {
        $(document).ready(
            $.ajax({
                "url": "/backend/exit/",
                "type": "POST",
                "success": function () {

                    location.href = "login-system.html"

                }
            }))
    })
</script>
</html>